﻿package {
	import data.NumericalValueData;
	import data.ResData;
	import data.SocketClient;
	
	import game.Scene;
	
	import laya.display.Sprite;
	import laya.display.Stage;
	import laya.net.Loader;
	import laya.utils.Handler;
	import laya.utils.Stat;
	import laya.webgl.WebGL;

	public class Main {
		
		private var scene:Scene
		public static var uiPannel:Sprite;
		
		public static var effPannel:Sprite
		public function Main() {
			//初始化引擎
			Laya.init(1136, 640,WebGL);
			Stat.show(0,0);
			//			Laya.stage.scaleMode = Stage.SCALE_FIXED_WIDTH;
			Laya.stage.alignV = Stage.ALIGN_MIDDLE;
			Laya.stage.alignH = Stage.ALIGN_CENTER;
			Laya.stage.scaleMode=Stage.SCALE_SHOWALL;
			Laya.stage.screenMode = Stage.SCREEN_HORIZONTAL;
			//			Laya.stage.bgColor = "#232628";
			Laya.loader.load(ResData.gameData, Handler.create(this, onUitLoaded), Handler.create(this, onAssetPro,null, false),Loader.TEXT);	
			//			var allPlayer:Array=[{"objectId":9,"x":100,"y":100,"rotation":0,"radian":0},{"objectId":6,"x":100,"y":100,"rotation":0,"radian":0},{"objectId":12,"x":100,"y":100,"rotation":0,"radian":0}];
			//			allPlayer.sort(Util.softList)
			
		}
		private function onAssetPro():void
		{
			// TODO Auto Generated method stub
			
		}
		
		private function test():void{
			var flag:Boolean=false;
			for(var i=0;i<3;i++){
				for(var j=0;j<10;j++){
					if(flag)continue;
					flag=true;
				}
				flag=false;
			}
		}
		
		private function onUitLoaded():void
		{
			// TODO Auto Generated method stub
			//			Laya.timer.loop(100,this,test)
			////			test();
			//			return;
			SocketClient.getInstance();
			uiPannel=new Sprite();
			effPannel=new Sprite();
			scene=new Scene();
			Laya.stage.addChild(scene);
			scene.scaleX=effPannel.scaleX=scene.scaleY=effPannel.scaleY=1;
			Laya.stage.addChild(effPannel);
			Laya.stage.addChild(uiPannel);
			
			//初始化表数据
			NumericalValueData.getInstance();
			//			SocketClient.getInstance().connectSocket();
			////			SocketClient.getInstance().startCommunicate();
		}
	}
}